#import <Foundation/Foundation.h>

// ----------- Class interface -----------------------------
@interface Person : NSObject

{
	int age;
	int weight;
}

// Method -(return value) called print, no args.
-(void) print;
// Set the age arg type int arg name a.
-(void) setAge: (int) a;
// Set the weight.
-(void) setWeight: (int) w;

@end


// ----------- Class implementation. ----------------------
@implementation Person

-(void) print
{
	NSLog(@"I am %i years old and weigh %i pounds", age, weight);
}

-(void) setAge:(int) a
{
	age = a;
}

-(void) setWeight:(int) w
{
	weight = w;
}

@end



// ---------------- Main method -----------------------------
int main (int argc, const char ** argv)
{
	// Reserve some memory.
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

	
	// ==== HELLO WORLD =====================================
	int n1 = 20;
	int n2 = 43;
	int sum = n1 + n2;
	
    // Log or display information on the screen.
	// @ sign makes this a NSLog string rather than a C string.
    NSLog(@"Hello, World!\n");
	NSLog(@"The sum of %i and %i is %i", n1, n2, sum);
	
	// =======================================================
	
	
	// ========= SIMPLE Person CLASS ==========================
	// Create a pointer to a person object.
	Person * person;
	
	// Allocate memory for the object.
	person = [Person alloc];
	
	// make the object usable.
	person = [person init];
	
	// Call methods.
	[person setAge: 29];
	[person setWeight: 400];
	[person print];
	
	// Free up the memory for the person object.
	[person release];
	//==========================================================
	
	
	
	
	// Give the memory back.
    [pool drain];
    
	
	// Return from main.
	return 0;
}
